/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * GUIVisualizacion.java
 *
 * Created on Oct 20, 2011, 6:33:12 PM
 */
package GUI.Procesamiento;

import GUIalmacen.JPanelMapa;
import GUIalmacen.Juego;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.JScrollPane;

/**
 *
 * @author fenartcos
 */
public class GUIVisualizacion extends javax.swing.JDialog {
    private Juego objJuego;
    private BufferedImage pared;
    private BufferedImage camino;
    private BufferedImage nuevo;

    /** Creates new form GUIVisualizacion */
    public GUIVisualizacion(java.awt.Frame parent, boolean modal) throws IOException {
        super(parent, modal);
        initComponents();
        inicializa();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLayeredPane1 = new javax.swing.JLayeredPane();
        btnCancelar = new javax.swing.JButton();
        btnAceptar1 = new javax.swing.JButton();
        panelMapa2 = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Visualización Almacén");
        setMinimumSize(new java.awt.Dimension(800, 600));
        setModal(true);

        btnCancelar.setText("Cancelar");
        btnCancelar.setMaximumSize(new java.awt.Dimension(100, 25));
        btnCancelar.setMinimumSize(new java.awt.Dimension(100, 25));
        btnCancelar.setPreferredSize(new java.awt.Dimension(100, 25));
        btnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelarActionPerformed(evt);
            }
        });
        btnCancelar.setBounds(610, 10, -1, -1);
        jLayeredPane1.add(btnCancelar, javax.swing.JLayeredPane.DEFAULT_LAYER);

        btnAceptar1.setText("Aceptar");
        btnAceptar1.setMaximumSize(new java.awt.Dimension(100, 25));
        btnAceptar1.setMinimumSize(new java.awt.Dimension(100, 25));
        btnAceptar1.setPreferredSize(new java.awt.Dimension(100, 25));
        btnAceptar1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAceptar1ActionPerformed(evt);
            }
        });
        btnAceptar1.setBounds(490, 10, -1, -1);
        jLayeredPane1.add(btnAceptar1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout panelMapa2Layout = new javax.swing.GroupLayout(panelMapa2);
        panelMapa2.setLayout(panelMapa2Layout);
        panelMapa2Layout.setHorizontalGroup(
            panelMapa2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 787, Short.MAX_VALUE)
        );
        panelMapa2Layout.setVerticalGroup(
            panelMapa2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 416, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(panelMapa2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLayeredPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 787, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelMapa2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnAceptar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAceptar1ActionPerformed

    }//GEN-LAST:event_btnAceptar1ActionPerformed

    private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed

        this.dispose();     }//GEN-LAST:event_btnCancelarActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(GUIVisualizacion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(GUIVisualizacion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(GUIVisualizacion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(GUIVisualizacion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                GUIVisualizacion dialog = null;
                try {
                    dialog = new GUIVisualizacion(new javax.swing.JFrame(), true);
                } catch (IOException ex) {
                    Logger.getLogger(GUIVisualizacion.class.getName()).log(Level.SEVERE, null, ex);
                }
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {

                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAceptar1;
    private javax.swing.JButton btnCancelar;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JPanel panelMapa2;
    // End of variables declaration//GEN-END:variables

    private void inicializa() throws IOException {

        objJuego = new Juego(26,47);

        objJuego.getObjMundo().llenarLaberinto(objJuego.getObjMundo());
        objJuego.getObjMundo().getMialmacen().muestraMapa();
        try {
            BufferedImage tile = ImageIO.read(new File("tile.png"));
           pared=tile.getSubimage(0,0,32,32);
           camino=ImageIO.read(new File("camino.png"));
           // mapa1=ImageIO.read(new File("mapa1.jpg"));
              nuevo = new BufferedImage(800,600,BufferedImage.TYPE_INT_RGB);
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        setLayout(null);
//        //JPanelMapa panelMapa = new JPanelMapa(this);
//        panelMapa.setSize(800,600);
//       //
//        panelMapa.setLocation(0,0);
//        panelMapa.setVisible(true);
//
//        panelMapa2=panelMapa;
//this.add(panelMapa);




//     panelSaco = new JPanelSaco(this);
//        panelSaco.setSize(256,96);
//        panelSaco.setLocation(352,608);
//          this.add(panelSaco);





        this.pack();
    }

    public BufferedImage getCamino() {
        return camino;
    }

    public void setCamino(BufferedImage camino) {
        this.camino = camino;
    }

    public BufferedImage getNuevo() {
        return nuevo;
    }

    public void setNuevo(BufferedImage nuevo) {
        this.nuevo = nuevo;
    }

    public Juego getObjJuego() {
        return objJuego;
    }

    public void setObjJuego(Juego objJuego) {
        this.objJuego = objJuego;
    }

  
    

    public BufferedImage getPared() {
        return pared;
    }

    public void setPared(BufferedImage pared) {
        this.pared = pared;
    }




}
